const { ipcMain, webContents } = require('electron');

ipcMain.on('webview-loaded', (event, id) => {
    const sniffViewWebContents = webContents.fromId(id);
    sniffViewWebContents.setWindowOpenHandler((details) => {
        sniffViewWebContents.stop();
        sniffViewWebContents.loadURL(details.url);
        return { action: 'deny' };
    });
});
